package pimpmypipe.pipe;

import java.io.StreamCorruptedException;

import pimpmypipe.interfaces.IOable;
import pimpmypipe.interfaces.Writeable;
import pimpmypipe.interfaces.Readable;;

/**
 * 
 * @author Benjamin
 */
public class Pipe<T> implements IOable<T, T> {
    
    private Readable<T> _in;
    private Writeable<T> _out;

    
    public void setIn(Readable<T> in) {
        _in = in;
    }

    public void setOut(Writeable<T> out) {
        _out = out;
    }

    @Override
    public T read() throws StreamCorruptedException {
        return _in.read();
    }

    @Override
    public void write(T value) throws StreamCorruptedException {
        _out.write(value);
    }
}
